<?php
namespace dingtalk;

use dingtalk\util\Http;

class Message
{
    /**
     * 发送普通消息
     * @param $accessToken
     * @param $opt
     * @return mixed
     */
    public static function sendToConversation($accessToken, $opt)
    {
        $response = Http::post("/message/send_to_conversation", ["access_token" => $accessToken], json_encode($opt));
        return obj2array($response);
    }

    /**
     * 服务窗会话接口
     * @param $accessToken
     * @param $opt
     * @return mixed
     */
    public static function send($accessToken, $opt)
    {
        $response = Http::post("/message/send", ["access_token" => $accessToken],json_encode($opt));
        return obj2array($response);
    }
}